﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace ProjectPigs.Util
{
    class Text
    {
        public const int LEFT = 0;
        public const int CENTER = 1;
        public const int RIGHT = 2;
        public const int MIDDLE = 3;


        public static void loadContent(ContentManager content)
        {

        }



        public static void drawString(SpriteFont sf, String text, Rectangle bounds, int align)
        {
            int x = 0;
            int y = 0;

            Vector2 textDim = sf.MeasureString(text);

            int textW = (int)textDim.X;
            int textH = (int)textDim.Y;

            switch (align)
            {
                case LEFT:
                    x = bounds.X;
                    y = bounds.Y;
                    break;
                case CENTER:
                    x = (bounds.X + (bounds.Width / 2)) - (textW / 2);
                    y = (bounds.Y + (bounds.Height / 2)) - (textH / 2);
                    break;
                case RIGHT:
                    x = (bounds.X + bounds.Width) - textW;
                    y = bounds.Y;
                    break;
                case MIDDLE:
                    x = (bounds.X + (bounds.Width / 2)) - (textW / 2);
                    y = bounds.Y;
                    break;
            }

            SystemInfo.sb.DrawString(sf, text, new Vector2(x, y), Color.Black);
            SystemInfo.sb.DrawString(sf, text, new Vector2(x - 1, y - 1), Color.White);

        }
    }
}
